package musicstore.interceptor;

import java.util.Map;

import musicstore.entity.User;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class OrderInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation ai) throws Exception {
		ActionContext ax = ai.getInvocationContext();
		Map<String,Object> sess = ax.getSession();
		User user = (User) sess.get("user");
		if(user!=null){
			return ai.invoke();
		}else{
			return "login";
		}
		
	}

}
